package br.com.linhadotempo.struts2;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import br.com.linhadotempo.util.Mensagens;
import br.com.linhadotempo.util.Sessao;
import br.com.linhadotempo.util.Util;

import com.opensymphony.xwork2.ActionSupport;

public class LinhaAction extends ActionSupport {

	private String ln;
	
	/*
	 * Action para remover um usuario
	 */
	@Action(value = "linhasJsp", results = { @Result(name = SUCCESS, location = Util.LINHAS_JSP) })
	public String linhasJsp() {
		try {
			Sessao.removeMessages();

			Sessao.put("linhaEscolhida", ln);
			
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			Mensagens.getInstance().tratarExceptions(e);
			return null;
		}
	}
	
	/*
	 * Action para remover um usuario
	 */
	@Action(value = "linhaJsp", results = { @Result(name = SUCCESS, location = Util.LINHADOTEMPO_JSP) })
	public String linhaJsp() {
		try {
			Sessao.removeMessages();

			Sessao.put("linhaEscolhida", ln);
			
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			Mensagens.getInstance().tratarExceptions(e);
			return null;
		}
	}

	public String getLn() {
		return ln;
	}

	public void setLn(String ln) {
		this.ln = ln;
	}
	private static final long serialVersionUID = 5308654385814463097L;
}
